<?php

namespace Summer\Shop\Http\Controllers;

use Illuminate\Routing\Controller;
use RLuders\JWTAuth\Classes\JWTAuth;
use Summer\Hub\Http\Controllers\Traits\ApiReturn;
use Input;
use Exception;
use Db;
use Summer\Shop\Models\BrowseModel;
use Summer\Shop\Models\CategoryModel;
use Summer\Shop\Models\FavoriteModel;
use Summer\Shop\Models\ProductModel;
use Summer\Shop\Models\RegGoodsModel;
use Summer\Shop\Models\ScoreGoodsModel;
use Summer\Shop\Models\ServiceModel;

class RegGoodsController extends Controller
{
    use ApiReturn;
    /**
     * 积分商品列表
     */
    public function index(JWTAuth $auth)
    {
        if (!$user = $auth->user()) {
            return $this->apiError('登录失效,请重新登录');
        }
        $page=Input::get('page',1);
        $page_size=Input::get('page_size',20);
        $query=RegGoodsModel::select();
        $query->with(['product']);
        $records=$query->paginate($page_size,$page);
        return $this->apiSuccess('操作成功',$records);
    }

}
